<?php
/**
 * 留言管理
 *
 * @package         YDCMS
 * @author          QQ:644157559 <644157559@qq.com>
 * @version         $Id: MessageService.class.php v1.0 2014-06-13 17:27:03 $
 */
namespace Admin\Service;
class MessageService extends CommonService{
    /**
     * 获取数据
     * @param type $id
     * @return type
     */
    public function getById($id) {
        return $this->getM()->getById($id);
    }
    
    /**
     * 回复
     * @param type $data
     * @return type
     */
    public function reply($data) {
        $MessageModel = $this->getD();
        if(false === ($message = $MessageModel->create($data))){
            return $this->errorResultReturn($MessageModel->getError());
        }
        if(false === $MessageModel->save($message)){
            return $this->errorResultReturn("系统繁忙！");
        }
        return $this->resultReturn(TRUE);
    }
    /**
     * 删除
     * @param type $id
     * @return type
     */
    public function delete($id) {
        return $this->getM()->where(array("id" => $id))->delete();
    }
    protected function getModelName() {
        return "Message";
    }
}
